package ua.org.enginer.controls.renderers {

import flash.events.Event;

import mx.controls.CheckBox;
import mx.controls.DataGrid;
import mx.controls.listClasses.BaseListData;
import mx.events.FlexEvent;
import mx.events.ListEvent;

import ua.org.enginer.controls.CheckBoxSelectionDataGrid;

// fixme: do not change state on click
public class DataGridSelectionIndicatorHeader extends CheckBox {
	
	private var grid:CheckBoxSelectionDataGrid
	
	public function DataGridSelectionIndicatorHeader() {
		super();
		addEventListener(Event.CHANGE, onChange)
		setStyle("paddingLeft", 3)
		toolTip = "Отметить все"
	}
	
	
	private function onChange(event:Event):void {
		grid.selectAll(selected)
	}
	
	override public function set listData(value:BaseListData):void {
		//super.listData = value
		grid = CheckBoxSelectionDataGrid(value.owner)
	}
	
	override public function set data(value:Object):void {
		// prevent default behavior
	}
	
}
}

